package com.min.db;

import java.sql.*;
import java.util.Map;

public class MysqlInfoTest {

    public static void main(String[] args) throws SQLException {
        // 创建对象
        MysqlInfo mysqlInfo = new MysqlInfo();

        // 获取连接
        Connection connection = mysqlInfo.getConnection();
        // 获取元数据
        DatabaseMetaData infoDatabaseMetaData = mysqlInfo.getDatabaseMetaData();
        //打印元数据
        mysqlInfo.getDataBaseInformations(infoDatabaseMetaData);

        //show variables
        Map<String, String> variableMap = mysqlInfo.getVariables();
        if (variableMap != null) {
            System.out.println("自动commit : " + variableMap.get("autocommit"));
            System.out.println("程序主目录 : " + variableMap.get("basedir"));
        }
        //SHOW status
        Map<String, String> statusMap = mysqlInfo.getStatus();
        if (statusMap != null) {
            System.out.println("创建的线程 : " + statusMap.get("Threads_created"));
            System.out.println("运行的线程 : " + statusMap.get("Threads_running"));
        }



        mysqlInfo.colseCon();
    }
}
